<%@ page language="java" pageEncoding="UTF-8"%>
<SCRIPT LANGUAGE="JavaScript">
		/**
		*gridUrl:请求数据url,
		*root:json数据串,
		*columnUrl:列头,
		*_data:columnUrl的参数{key:value}
		*_container:渲染div容器id
		*/
		
		function listData(gridUrl,root,columnUrl,_data,_container){
			ajaxUrl(columnUrl,_data,function(data){
			 	var str = data.split("&");
			    var config = getJqGridOption(gridUrl,root);
				//config.colNames = ['ID','唯一','登陆名','密码','姓名','是否有效','创建人','创建时间'];
	            //config.colModel = [{name:'id',index:'id',width:'60',hidden:true,align:'left'},{name:'ywid',index:'ywid',width:'60',hidden:true,align:'left'},{name:'dlm',index:'dlm',width:'60',hidden:true,align:'left'},{name:'mm',index:'mm',width:'60',hidden:true,align:'left'},{name:'xm',index:'xm',width:'60',hidden:false,align:'left'},{name:'sfyx',index:'sfyx',width:'60',hidden:false,align:'left'},{name:'cjr',index:'cjr',width:'60',hidden:false,align:'left'},{name:'cjsj',index:'cjsj',width:'60',hidden:false,align:'left'}];
	            config.colNames = str[0];
	            config.colModel = str[1];
	            jQuery(_container).jqGrid(config).navGrid('#pager1',{del:false,add:false,edit:false,search:true,refresh:true},{},{},{},{multipleSearch:true});
				jQuery(window).bind('resize', function() {
	            jQuery(_container).setGridWidth(jQuery(window).width() *0.998);
	            });
			});
		}
				
		function ajaxUrl(_url,_data,callfunc){
			jQuery.ajax({
		    type: 'POST',
		    url:_url,
		    data:_data,
		    success: function(data){
		     if(callfunc){
		     	callfunc(data);
		     }
		   },
		  dataType:'string'
		});
		}
		
		function getJqGridOption(_url,_root){
	 		return {  
	        datatype: "json", //将这里改为使用JSON数据  
	        url:_url, //这是Action的请求地址  
	        mtype: 'POST',  
	        //autoheight:true,
	        height: 410,
	        //scroll: true, 
	        //colNames:['ID','唯一','登陆名','密码','姓名','是否有效','创建人','创建时间'],
	       // colModel:[{name:'id',index:'id',width:'60',hidden:false,align:'left'},{name:'ywid',index:'ywid',width:'60',hidden:false,align:'left'},{name:'dlm',index:'dlm',width:'60',hidden:false,align:'left'},{name:'mm',index:'mm',width:'60',hidden:false,align:'left'},{name:'xm',index:'xm',width:'60',hidden:false,align:'left'},{name:'sfyx',index:'sfyx',width:'60',hidden:false,align:'left'},{name:'cjr',index:'cjr',width:'60',hidden:false,align:'left'},{name:'cjsj',index:'cjsj',width:'60',hidden:false,align:'left'}],
	        autowidth:true, //自动调整宽度
	        pager: 'pager1', //分页工具栏  
	        rowNum:15, //每页显示记录数  
	        viewrecords: true, //是否显示行数  
	        rowList:[15,30,60,100,1000], //可调整每页显示的记录数  
	        multiselect: true, //是否支持多选  
	        sortname: 'id', //首次加载要进行排序的字段 
	        sortorder: "asc", //排序方式
	        //loadonce:true, //一次加载所有数据
	        onSortCol: function (index, colindex, sortorder){
							//列排序事件
			 				//alert('onSortCol index=>'+index +" colindex=>"+colindex +" sortorder=>"+sortorder);
			},
			gridview:true, 
	        caption: "用 户 信 息" ,
	        jsonReader: {      
        		root: _root, 
        		repeatitems : false      
     		} ,
     		userDataOnFooter : true, //总计
     		//altRows : true,         //
     		footerrow:true      
	    	}
	 	}
</SCRIPT> 